package com.xjscrm.console.vo;

import com.xjscrm.console.dto.circle.CircleVisibleDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 朋友圈任务(CircleTask)表VO
 *
 * @author szl
 * @since 2024-04-09 10:33:17
 */
@Data
@ApiModel("朋友圈任务 VO对象")
public class CircleTaskVO {

    @ApiModelProperty("主键ID")
    private Long id;

    @ApiModelProperty("商户ID")
    private Long merId;

    @ApiModelProperty("员工Id")
    private Long staffId;

    @ApiModelProperty("分组Id")
    private Long groupId;

    @ApiModelProperty("公司名称")
    private String name;

    @ApiModelProperty("是否延时发送. 0-立即发送, 1-定时发送")
    private Integer delay;

    @ApiModelProperty("执行时间")
    private Integer executeTime;

    @ApiModelProperty("可见. 10-全部发送, 11-部分可见")
    private Integer visible;

    @ApiModelProperty("可见的标签数组")
    private List<TagInfo> visibleTags = new ArrayList<>();

    @ApiModelProperty("可见条件")
    private CircleVisibleDTO visibleCondition;

    @ApiModelProperty("朋友圈内容. 0-图片, 1-视频, 2-链接, 100-纯文本")
    private Integer contentType;

    @ApiModelProperty("文案")
    private String text;

    @ApiModelProperty("图片地址集合")
    private List<String> imgs;

    @ApiModelProperty("视频地址集合")
    private List<String> videos;

    @ApiModelProperty("链接地址")
    private String link;

    @ApiModelProperty("是否追加评论. 0-不追加, 1-追加")
    private Integer appendComment;

    @ApiModelProperty("评论追加时间")
    private Integer commentSendTime;

    @ApiModelProperty("评论追加时间单位. 1: 分钟, 2: 秒")
    private Integer commentSendTimeUnit;

    @ApiModelProperty("评论数组. 1: 分钟, 2: 秒")
    private List<String> comments;

    @ApiModelProperty("状态. 20-待执行, 21-执行中, 22-已完成, 23-已取消")
    private Integer status;

    @ApiModelProperty("延迟删除. 0-不延迟删除, 1-延迟删除")
    private Integer delayDel;

    @ApiModelProperty("延迟删除")
    private Integer delayDelTime;

    @ApiModelProperty("延迟删除时间单位. 1: 分钟, 2: 秒")
    private Integer delayDelTimeUnit;

    @ApiModelProperty("创建时间")
    private Integer createTime;

    @ApiModelProperty("修改时间")
    private Integer updateTime;

    @ApiModelProperty("机器人列表")
    private List<DeviceInfo> deviceList = new ArrayList<>();
    @ApiModelProperty("机器人Id列表")
    private List<Long> deviceUniqueIds = new ArrayList<>();

    public void addDevice(Long deviceUniqueId, String deviceName) {
        DeviceInfo r = new DeviceInfo();
        r.setDeviceUniqueId(deviceUniqueId);
        r.setDeviceName(deviceName);
        this.deviceList.add(r);
    }

    public void addTag(Long id, String name) {
        TagInfo r = new TagInfo();
        r.setId(id);
        r.setName(name);
        this.visibleTags.add(r);
    }

    @Data
    public static class DeviceInfo {

        @ApiModelProperty("机器人Id")
        private Long deviceUniqueId;
        @ApiModelProperty("机器人名称")
        private String deviceName;
    }

    @Data
    public static class TagInfo {

        @ApiModelProperty("标签Id")
        private Long id;
        @ApiModelProperty("标签名称")
        private String name;
    }
}

